package com.myapp.ruyixing.http;

import java.io.Serializable;
import java.util.List;

import org.json.JSONObject;

public class TrainSearchListParser extends RYJSONParser {

	@Override
	public Object parse(JSONObject jsonObject) {
		if (getErrno(jsonObject) != NO_ERROR) {
			return null;
		}

		JSONObject data = jsonObject.optJSONObject("data");
		
		TrainSearch o = new TrainSearch();

		if (jsonObject != null) {
			o = loadByGson(data, TrainSearch.class);
		}

		return o;
	}
	
	public static class TrainSearch {
		public String from;
		public String to;
		public String time;
		public String shopname;
		public int total;
		public List<TrainSearchItem> items;
	}
	
	public static class TrainSearchItem implements Serializable {
		private static final long serialVersionUID = 3536018244537995340L;
		
		public String trainid;
		public String starttime;
		public String endtime;
		public String trainname;
		public String traincode;
		public String startcity;
		public String endcity;
		public String coattime;
		public String ticketname;
		public String ticketprice;
		
		public String date;
	}
}
